﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AAA.Meta.Quote.Data
{
    public class PriceVolumeData
    {
        private DateTime _dtPVDateTime;
        private string _strSymbolId;
        private List<float> _lstPrice;
        private List<float> _lstVolume;
        private List<float> _lstTickVolume;

        public PriceVolumeData()
        {
            _lstPrice = new List<float>();
            _lstVolume = new List<float>();
            _lstTickVolume = new List<float>();
        }

        public DateTime PVDateTime
        {
            get { return _dtPVDateTime; }
            set { _dtPVDateTime = value; }
        }

        public string SymbolId
        {
            get { return _strSymbolId; }
            set { _strSymbolId = value; }
        }

        public void AddData(float fPrice, float fVolume)
        {
            AddData(fPrice, fVolume, 1);
        }
        public void AddData(float fPrice, float fVolume, float fTickVolume)
        {
            int iIndex = _lstPrice.IndexOf(fPrice);

            if (iIndex < 0)
            {
                _lstPrice.Add(fPrice);
                _lstVolume.Add(fVolume);
                _lstTickVolume.Add(fTickVolume);                
            }
            else
            {
                _lstVolume[iIndex] += fVolume;
                _lstTickVolume[iIndex] += fTickVolume;
            }
        }

        public List<float> Price
        {
            get { return _lstPrice; }
        }

        public List<float> Volume
        {
            get { return _lstVolume; }
        }

        public List<float> TickVolume
        {
            get { return _lstTickVolume; }
        }
    }
}
